cmake_minimum_required(VERSION 2.6)

add_definitions(
  -D_GNU_SOURCE
  -DHAVE_CONFIG_H
)

set(GST_VERSION_MICRO 18)
set(GST_VERSION_NANO 0)
set(VERSION ${GST_MAJORMINOR}.${GST_VERSION_MICRO})
set(PACKAGE "gst-plugins-bad")
set(PACKAGE_NAME "GStreamer Bad Plugins")
set(PACKAGE_BUGREPORT "http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer")
set(PACKAGE_STRING "${PACKAGE_NAME} ${VERSION}")
set(PACKAGE_TARNAME ${PACKAGE})
set(PACKAGE_VERSION ${VERSION})
set(GETTEXT_PACKAGE "${PACKAGE}-${GST_MAJORMINOR}")

# Optional dependencies
find_library(AMRWBENC_LIBRARIES amrwb)
find_path(AMRWBENC_INCLUDE_DIRS amrwb/enc_if.h)
find_library(BZ2_LIBRARIES bz2)
find_path(BZ2_INCLUDE_DIRS bzlib.h)
find_library(DIVX_ENCORE_LIBRARIES NAMES divxencore encore)
find_path(DIVX_ENCORE_INCLUDE_DIRS encore2.h)
find_library(DIVX_DECORE_LIBRARIES NAMES divxdecore decore)
find_path(DIVX_DECORE_INCLUDE_DIRS decore2.h)

find_library(FLITE_LIBRARIES flite)
find_path(FLITE_INCLUDE_DIRS flite/flite.h)
find_library(GSM_LIBRARIES gsm)
find_path(GSM_INCLUDE_DIRS gsm/gsm.h)
find_library(JASPER_LIBRARIES jasper)
find_path(JASPER_INCLUDE_DIRS jasper/jasper.h)
find_library(MUSEPACK_LIBRARIES mpcdec)
find_path(MUSEPACK_INCLUDE_DIRS mpcdec/mpcdec.h)
find_library(NAS_LIBRARIES audio)
find_path(NAS_INCLUDE_DIRS audio/audiolib.h)
find_library(WILDMIDI_LIBRARIES WildMidi)
find_path(WILDMIDI_INCLUDE_DIRS wildmidi_lib.h)
find_library(SPC_LIBRARIES openspc)
find_path(SPC_INCLUDE_DIRS openspc.h)
find_library(TIGER_LIBRARIES tiger)
find_path(TIGER_INCLUDE_DIRS tiger/tiger.h)
find_library(GME_LIBRARIES gme)
find_path(GME_INCLUDE_DIRS gme/gme.h)
find_library(XVID_LIBRARIES xvidcore)
find_path(XVID_INCLUDE_DIRS xvid.h)
find_path(WININET_INCLUDE_DIRS wininet.h)
find_path(ACM_INCLUDE_DIRS msacm.h)

pkg_check_modules(ALSA alsa>=0.9.1)
pkg_check_modules(LIBASS libass>=0.9.4)
pkg_check_modules(APEXSINK openssl>=0.9.5 libcrypto)
pkg_check_modules(LIBCDAUDIO libcdaudio)
pkg_check_modules(CELT celt>=0.4.0)
pkg_check_modules(CELT_0_5 celt>=0.5.0)
pkg_check_modules(CELT_0_7 celt>=0.7.0)
pkg_check_modules(COG libpng12 orc-0.4>=0.4.3)
pkg_check_modules(LIBDC1394 libdc1394-2>=2.0.0)
pkg_check_modules(DIRECTFB directfb>=0.9.24)
pkg_check_modules(DIRAC dirac>=0.10)
pkg_check_modules(DTS libdca)
pkg_check_modules(DVDNAV dvdnav)
pkg_check_modules(EXIF libexif>=0.6.16)
pkg_check_modules(IPTC libiptcdata>=1.0.2)
pkg_check_modules(XMP exempi-2.0>=1.99.5)
pkg_check_modules(JACK jack>=0.99.10)
pkg_check_modules(KATE kate>=0.1.7)
pkg_check_modules(LV2 slv2>=0.6.6)
pkg_check_modules(LRDF lrdf)
pkg_check_modules(LIBMMS libmms>=0.4)
pkg_check_modules(LIBMODPLUG libmodplug)
pkg_check_modules(LIBMIMIC libmimic)
pkg_check_modules(MUSICBRAINZ libmusicbrainz>=2.1.0)
pkg_check_modules(GMYTH gmyth>=0.4 gmyth<=0.7.99)
pkg_check_modules(NEON neon>=0.26.0  neon<=0.29.99)
pkg_check_modules(OFA libofa>=0.9.3)
pkg_check_modules(RSVG librsvg-2.0>=2.14 cairo)
pkg_check_modules(TIMIDITY libtimidity)
pkg_check_modules(SDL sdl)
pkg_check_modules(SNDFILE sndfile>=1.0.16)
pkg_check_modules(SOUNDTOUCH soundtouch-1.0)
pkg_check_modules(SWFDEC swfdec-0.3>=0.3.6)
pkg_check_modules(THEORADEC theoradec)
pkg_check_modules(SCHRO schroedinger-1.0>=1.0.7)



redefine(CELT_0_5_FOUND HAVE_CELT_0_5)
redefine(CELT_0_7_FOUND HAVE_CELT_0_7)

if (${EXIF_FOUND} OR ${IPTC_FOUND} OR ${XMP_FOUND})
  set(HAVE_METADATA 1)
endif()


include_directories(${CMAKE_BINARY_DIR}/include/gstreamer-${GST_MAJORMINOR})
include_directories(${CMAKE_SOURCE_DIR}/gstreamer-0.10.29/gst)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/gst-libs)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_CURRENT_BINARY_DIR}/gst-libs)

include_directories(${GLIB_INCLUDE_DIRS})
include_directories(${GMODULE_INCLUDE_DIRS})
include_directories(${LIBXML_INCLUDE_DIRS})


set(FAAD_IS_NEAAC "0" CACHE STRING "Using new FAAD header")
find_path(FAAD_NE_INCLUDE_DIRS neaac.h)
if(FAAD_NE_INCLUDE_DIRS)
  set(FAAD_IS_NEAAC "1")
  include_directories(${FAAD_NE_INCLUDE_DIRS})
endif()

configure_file(
  ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
  ${CMAKE_CURRENT_BINARY_DIR}/config.h
)

configure_file(
  ${CMAKE_CURRENT_SOURCE_DIR}/_stdint.h.in
  ${CMAKE_CURRENT_BINARY_DIR}/_stdint.h
)

add_subdirectory(ext/alsaspdif)
add_subdirectory(ext/amrwbenc)
add_subdirectory(ext/apexsink)
add_subdirectory(ext/assrender)
add_subdirectory(ext/bz2)
add_subdirectory(ext/cdaudio)
add_subdirectory(ext/celt)
#add_subdirectory(ext/cog)
add_subdirectory(ext/dc1394)
add_subdirectory(ext/dirac)
add_subdirectory(ext/directfb)
add_subdirectory(ext/divx)
add_subdirectory(ext/dts)
add_subdirectory(ext/faac)
add_subdirectory(ext/faad)
add_subdirectory(ext/flite)
#add_subdirectory(ext/gme)
add_subdirectory(ext/gsm)
add_subdirectory(ext/jack)
add_subdirectory(ext/jp2k)
add_subdirectory(ext/kate)
#add_subdirectory(ext/ladspa)
add_subdirectory(ext/libmms)
#add_subdirectory(ext/lv2)
add_subdirectory(ext/metadata)
add_subdirectory(ext/mimic)
#add_subdirectory(ext/modplug)
#add_subdirectory(ext/mpeg2enc)
#add_subdirectory(ext/mplex)
add_subdirectory(ext/musepack)
add_subdirectory(ext/musicbrainz)
add_subdirectory(ext/mythtv)
add_subdirectory(ext/nas)
add_subdirectory(ext/neon)
add_subdirectory(ext/ofa)
add_subdirectory(ext/resindvd)
add_subdirectory(ext/rsvg)
add_subdirectory(ext/schroedinger)
add_subdirectory(ext/sdl)
add_subdirectory(ext/sndfile)
#add_subdirectory(ext/soundtouch)
add_subdirectory(ext/spc)
add_subdirectory(ext/swfdec)
#add_subdirectory(ext/theora)
add_subdirectory(ext/timidity)
add_subdirectory(ext/xvid)
#add_subdirectory(ext/zbar)
add_subdirectory(gst/adpcmdec)
add_subdirectory(gst/adpcmenc)
add_subdirectory(gst/aiff)
add_subdirectory(gst/asfmux)
add_subdirectory(gst/audioparsers)
add_subdirectory(gst/autoconvert)
add_subdirectory(gst/bayer)
add_subdirectory(gst/camerabin)
add_subdirectory(gst/cdxaparse)
add_subdirectory(gst/dataurisrc)
add_subdirectory(gst/dccp)
add_subdirectory(gst/debugutils)
add_subdirectory(gst/dtmf)
add_subdirectory(gst/dvdspu)
add_subdirectory(gst/festival)
add_subdirectory(gst/freeze)
add_subdirectory(gst/frei0r)
add_subdirectory(gst/h264parse)
add_subdirectory(gst/hdvparse)
add_subdirectory(gst/id3tag)
add_subdirectory(gst/jpegformat)
add_subdirectory(gst/legacyresample)
add_subdirectory(gst/librfb)
add_subdirectory(gst/liveadder)
add_subdirectory(gst/mpeg4videoparse)
add_subdirectory(gst/mpegdemux)
add_subdirectory(gst/mpegpsmux)
add_subdirectory(gst/mpegtsmux)
add_subdirectory(gst/mpegvideoparse)
add_subdirectory(gst/mve)
add_subdirectory(gst/mxf)
add_subdirectory(gst/nsf)
add_subdirectory(gst/nuvdemux)
add_subdirectory(gst/pcapparse)
add_subdirectory(gst/pnm)
add_subdirectory(gst/qtmux)
add_subdirectory(gst/rawparse)
add_subdirectory(gst/real)
add_subdirectory(gst/rtpmux)
add_subdirectory(gst/scaletempo)
add_subdirectory(gst/sdp)
add_subdirectory(gst/selector)
add_subdirectory(gst/siren)
add_subdirectory(gst/speed)
add_subdirectory(gst/stereo)
add_subdirectory(gst/subenc)
add_subdirectory(gst/tta)
add_subdirectory(gst/valve)
add_subdirectory(gst/videomeasure)
add_subdirectory(gst/videosignal)
add_subdirectory(gst/vmnc)
add_subdirectory(gst-libs/gst/interfaces)
add_subdirectory(gst-libs/gst/signalprocessor)
add_subdirectory(gst-libs/gst/video)
